<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	SimpleDateFormat sdf = new SimpleDateFormat("dd-mm-yyyy");
	String fecha = sdf.format(new Date()); 
	request.setAttribute("path", request.getContextPath());
%>
<html> 
	<head>
		<title>JSP for CrearPedidoForm form</title>
		<jsp:include page="/includes.jsp"></jsp:include>
	</head>
	<body>
		<jsp:include page="/menu-bar.jsp"></jsp:include>
		<div class="container">
			<h3> Seleccione el cliente para crear un nuevo pedido </h3>
			<table align="center">
				<html:form action="/pedido/registrar">
					<tr><td colspan="3"><html:hidden property="fecha" value="<%= fecha %>"/><html:errors property="fecha"/></td></tr>
					<tr>
						<th>Cliente :</th>
						<td>
							<html:select property="cliente">
								<c:forEach var="row" items="${clientes}">
									<option value="${row.id}"> ${row.cedula} | ${row.apellido}, ${ row.nombre } </option>
								</c:forEach>
							</html:select>
						</td>
						<td><html:errors property="cliente"/></td>
					</tr>
					<tr>
						<td colspan="3">
							<html:submit styleClass="btn btn-success" value="Seleccionar"/>
							<html:cancel styleClass="btn btn-danger" value="Cancelar Pedido"/>
						</td>
					</tr>
				</html:form>
			</table>
		</div>
	</body>
</html>

